<template>
  <div class="container">
    <!-- <el-table  :data="list.slice((currentPage-1)*pagesize, currentPage*pagesize)" fit highlight-current-row style="width: 100%"> -->
    <el-table  id="enforce" :data="enforceList" highlight-current-row style="width: 100%" :header-cell-style="{background:'#EEF3FC',color:'#333333'}"  >
      <el-table-column
        label="序号"
        type="index"
        style="width: 8%"
        align="center">
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="投诉类型">
        <template slot-scope="scope">
          <span>{{ scope.row.complaintType }}</span>
        </template>
      </el-table-column>

      <el-table-column style="width: 12%" align="center" label="机构名称">
        <template slot-scope="scope">
          <span>{{ scope.row.firmName }}</span>
        </template>
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="培训类型">
        <template slot-scope="scope">
          <span>{{ scope.row.trainingType }}</span>
        </template>
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="举报时间">
        <template slot-scope="scope">
          <span>{{ scope.row.createTime }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="isShow == '2'" style="width: 12%" align="center" label="执法人">
        <template slot-scope="scope">
          <span>{{ scope.row.auditUser }}</span>
        </template>
      </el-table-column>
      <el-table-column v-if="isShow == '2'" style="width: 12%" align="center" label="执法时间">
        <template slot-scope="scope">
          <span>{{ scope.row.auditTime }}</span>
        </template>
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="操作">
        <template slot-scope="scope">
          <el-button type="text"  @click="urlDetailChange(scope.row)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
      <!-- :disabled="loading" -->
    
    <!-- <el-pagination class="pagination-a" background layout="prev, pager, next" :total=lawListData.length @current-change="current_change">
    </el-pagination> -->
  </div>
</template>

<script>
  export default {

    filters: {
      statusFilter(status) {
        const statusMap = {
          published: 'success',
          draft: 'info',
          deleted: 'danger'
        }
        return statusMap[status]
      }
    },
    props: {
      type:{
        type:String
      },
      enforceList: {
        type: Array
      }
    },
    data() {
      return {
        lawListData:[],
        isShow:1,
        listQuery: {
          page: 1,
          limit: 5,
          type: this.type,
          sort: '+id'
        },
         // 分页加载
        loading: false,
        pageSizes: [10, 50, 100, 200, 500],
        total: 0,
        pagesize:10,
        currentPage:1,
      }
    },
    created() {
      console.log('获取传递过来的执法列表数组this.type',this.type)
      
    },
     // 监听路由
    watch: {
       $route: {
        deep: true,
        immediate: true,
        handler(val) {
          console.log('监听执法路由',val.query.tab)
          if(val.query){
            this.isShow=val.query.tab
          }
        }
      }
    },
    methods: {
      // 条数变化
      handleSizeChange(val) {
        console.log('条数变化',val)
        this.currentPage = 1;
        this.pagesize = val
        this.getLawListData()

      },
      // 换页
      handleCurrentChange(val) {
        console.log('换页',val)
        this.currentPage = val;
        this.getLawListData()
      },
      // 执法列表跳转事件
        // 详情跳转
      urlDetailChange(row){
        let id=''
        console.log('获取转转的',this.type)
        this.$router.push(
          { name: 'enforce-particulars',
           params: {id:this.type,reportId:row.reportId} 
          }
        )
      },
      open() {
        this.$alert('<strong>机构内容从法理基础来讲，教育培训机构享有的权利属于社会教育权，其存在具有一定的法理基础，教育培训机构在民法中是“特殊企业法人”，其公益属性是不同于一般企业法人最显著的特征；在行政法中是“行政相对人”，与政府构成行政法律关系。归属于社会教育权范畴的教育培训机构，相对于国家教育权而言，具有独特的法律属性。</strong>', '未通过原因', {
          dangerouslyUseHTMLString: true
        });
      },
      // current_change:function(currentPage){
      //   this.currentPage = currentPage;
      // },
    }
  }
</script>
<style scoped lang='scss'>
.container{
  // 设置表格的每一个表格的高度
  /deep/.el-table td, .el-table th{
    padding: 4px 0;
  }
}

</style>

